//Create User, Role and Group instances
User someUser;
Role managerRole;
Role developerRole;
Group salesGroup;
Group employeeGroup;
//Assign a manager role to someUser in the salesGroup
identityManager.grantGroupRole(someUser, managerRole, salesGroup);
//Assign developer role to someUser in the employeeGroup
identityManager.grantGroupRole(someUser, developerRole, employeeGroup);
//Verify that someUser has manager role in sales group and developer role in employee group
assertTrue(identityManager.hasGroupRole(someUser, managerRole, salesGroup));
assertTrue(identityManager.hasGroupRole(someUser, developerRole, employeeGroup));
//Check that someUser does not have developer role in the sales group
assertFalse(identityManager.hasGroupRole(someUser, developerRole, salesGroup));